package com.wanxi.map;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class MyStreamSet {
    public static void main(String[] args) {
        Set<String> set = new HashSet<>();
        set.add("aaa");
        set.add("aaaa");
        set.add("aaaaa");
        set.add("aaaaaa");
        Stream<String> streamSet = set.stream();
        System.out.println(set);
        List<String> list = new ArrayList<>();
        list.add("bb");
        list.add("bbb");
        list.add("bbb");
        list.add("bbbb");
//        List<String> collect = list.stream().distinct().collect(Collectors.toList());
        list.stream().count();
        list.stream().forEach(new Consumer<String>() {
            @Override
            public void accept(String s) {
                System.out.println(s);
            }
        });
//        List<String> collect = Stream.concat(streamList, streamSet).collect(Collectors.toList());
//        List<String> collect = set.stream().skip(2).collect(Collectors.toList());
//        List<String> collect = set.stream().filter(new Predicate<String>() {
//            @Override
//            public boolean test(String s) {
//                return s.length() == 4;
//            }
//        }).collect(Collectors.toList());
//        List<String> collect = set.stream().limit(2).collect(Collectors.toList());
//        System.out.println(collect);
    }
}
